package java_zuoye_3;


public class homework_4 {
	public static void main(String[] args) {
		int num = 0;
		int flag = 0;
		for(int i = 0;i <= 1000; i++) {
			if(isHuiwen(i) && isZishu(i)) {
				System.out.print(i + ",");
				num++;
				flag = 1;
			}
			if(num % 10 == 0 && flag == 1) {
				System.out.println();
				flag = 0;
			}
		}
	}
	
	public static boolean isHuiwen(int i) {
		if (i < 0 || i >= 1000) {
            return false;
        }

        int onesDigit = i % 10;
        int tensDigit = (i / 10) % 10;
        int hundredsDigit = i / 100;


        return onesDigit == hundredsDigit;
	    }
	
	public static boolean isZishu(int i) {
		for(int j = 2; j < i; j++) {
			if(i % j == 0) {
				return false;
			}
		}
		return true;
	}
}
